package com.sxz.sbs.module.order.presenter;

import com.sxz.sbs.app.App;
import com.sxz.sbs.module.order.mode.OrderDetailBean;
import com.sxz.sbs.module.order.view.IOrderDetailView;
import com.sxz.sbs.rx.RxPresenter;
import com.sxz.sbs.rx.RxSubscriber;
import com.sxz.sbs.rx.RxUtil;

import java.util.HashMap;

/**
 * @author : tian
 * @date : 2018/04/16
 * @des :订单详情P
 */

public class OrderDetailPresenter extends RxPresenter<IOrderDetailView>{
    /**
     * 获取订单详情
     * @param map
     */
    public void getOrderDetail (HashMap<String,Object> map) {
        addSubscribe(App.getInstance().getApi().getOrderDetail(map)
                .compose(RxUtil.<OrderDetailBean>handleResult())
                .subscribeWith(new RxSubscriber<OrderDetailBean>(mView,true){
                    @Override
                    public void onNext(OrderDetailBean token) {
                        mView.onGetOrderDetailSuccess(token);
                    }
                })
        );
    }
}
